<!DOCTYPE html>
<html>
<head><meta name="generator" content="Hexo 3.8.0">
    

    

    



    <meta charset="utf-8">
    
    
    
    
    <title>浅拷贝与深拷贝 | lafen | lafen&#39;s personal blog</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    
    <meta name="theme-color" content="#3F51B5">
    
    
    <meta name="keywords" content="js">
    <meta name="description" content="概念浅拷贝就是对复杂数据类型进行拷贝操作的时候，只是进行了简单的地址引用，并没有开辟新的栈空间来储存，此时在修改原来的对象时，会影响到新的对象。 光讲实在抽象了，直接往下看发生了什么12345678910111213var arr = [    &amp;#123;name:&apos;Andy&apos;&amp;#125;,    &amp;#123;name:&apos;Bob&apos;&amp;#125;,    &amp;#123;name:&apos;Cindy&apos;&amp;#12">
<meta name="keywords" content="js">
<meta property="og:type" content="article">
<meta property="og:title" content="浅拷贝与深拷贝">
<meta property="og:url" content="https://lafen.gitee.io/2019/01/22/js-浅拷贝与深拷贝/js-浅拷贝与深拷贝/index.html">
<meta property="og:site_name" content="lafen">
<meta property="og:description" content="概念浅拷贝就是对复杂数据类型进行拷贝操作的时候，只是进行了简单的地址引用，并没有开辟新的栈空间来储存，此时在修改原来的对象时，会影响到新的对象。 光讲实在抽象了，直接往下看发生了什么12345678910111213var arr = [    &amp;#123;name:&apos;Andy&apos;&amp;#125;,    &amp;#123;name:&apos;Bob&apos;&amp;#125;,    &amp;#123;name:&apos;Cindy&apos;&amp;#12">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2019-11-17T03:05:00.586Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="浅拷贝与深拷贝">
<meta name="twitter:description" content="概念浅拷贝就是对复杂数据类型进行拷贝操作的时候，只是进行了简单的地址引用，并没有开辟新的栈空间来储存，此时在修改原来的对象时，会影响到新的对象。 光讲实在抽象了，直接往下看发生了什么12345678910111213var arr = [    &amp;#123;name:&apos;Andy&apos;&amp;#125;,    &amp;#123;name:&apos;Bob&apos;&amp;#125;,    &amp;#123;name:&apos;Cindy&apos;&amp;#12">
    
        <link rel="alternate" type="application/atom+xml" title="lafen" href="/atom.xml">
    
    <link rel="shortcut icon" href="/img/favicon.ico">
    <link rel="stylesheet" href="//unpkg.com/hexo-theme-material-indigo@latest/css/style.css">
    <script>window.lazyScripts=[]</script>

    <!-- custom head -->
    

</head>

<body>
    <div id="loading" class="active"></div>

    <aside id="menu" class="hide">
  <div class="inner flex-row-vertical">
    <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menu-off">
        <i class="icon icon-lg icon-close"></i>
    </a>
    <div class="brand-wrap" style="background-image:url(/img/brand.jpg)">
      <div class="brand">
        <a href="/" class="avatar waves-effect waves-circle waves-light">
          <img src="/img/avatar.jpg">
        </a>
        <hgroup class="introduce">
          <h5 class="nickname">lafen</h5>
          <a href="mailto:1031822863@qq.com" title="1031822863@qq.com" class="mail">1031822863@qq.com</a>
        </hgroup>
      </div>
    </div>
    <div class="scroll-wrap flex-col">
      <ul class="nav">
        
            <li class="waves-block waves-effect">
              <a href="/">
                <i class="icon icon-lg icon-home"></i>
                home
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/archives">
                <i class="icon icon-lg icon-archives"></i>
                Archives
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/tags">
                <i class="icon icon-lg icon-tags"></i>
                Tags
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/categories">
                <i class="icon icon-lg icon-th-list"></i>
                Categories
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://github.com/zhongxiaotian" target="_blank">
                <i class="icon icon-lg icon-github"></i>
                Github
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="http://www.weibo.com/" target="_blank">
                <i class="icon icon-lg icon-weibo"></i>
                Weibo
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://gitee.com/lafen" target="_blank">
                <i class="icon icon-lg icon-link"></i>
                Gitee
              </a>
            </li>
        
      </ul>
    </div>
  </div>
</aside>

    <main id="main">
        <header class="top-header" id="header">
    <div class="flex-row">
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light on" id="menu-toggle">
          <i class="icon icon-lg icon-navicon"></i>
        </a>
        <div class="flex-col header-title ellipsis">浅拷贝与深拷贝</div>
        
        <div class="search-wrap" id="search-wrap">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="back">
                <i class="icon icon-lg icon-chevron-left"></i>
            </a>
            <input type="text" id="key" class="search-input" autocomplete="off" placeholder="输入感兴趣的关键字">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="search">
                <i class="icon icon-lg icon-search"></i>
            </a>
        </div>
        
        
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menuShare">
            <i class="icon icon-lg icon-share-alt"></i>
        </a>
        
    </div>
</header>
<header class="content-header post-header">

    <div class="container fade-scale">
        <h1 class="title">浅拷贝与深拷贝</h1>
        <h5 class="subtitle">
            
                <time datetime="2019-01-22T11:20:50.000Z" itemprop="datePublished" class="page-time">
  2019-01-22
</time>


	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/js/">js</a></li></ul>

            
        </h5>
    </div>

    


</header>


<div class="container body-wrap">
    
    <aside class="post-widget">
        <nav class="post-toc-wrap post-toc-shrink" id="post-toc">
            <h4>TOC</h4>
            <ol class="post-toc"><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#概念"><span class="post-toc-number">1.</span> <span class="post-toc-text">概念</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-4"><a class="post-toc-link" href="#浅拷贝"><span class="post-toc-number">1.1.</span> <span class="post-toc-text">浅拷贝</span></a></li></ol></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#现象"><span class="post-toc-number">2.</span> <span class="post-toc-text">现象</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#原因"><span class="post-toc-number">3.</span> <span class="post-toc-text">原因</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#方法"><span class="post-toc-number">4.</span> <span class="post-toc-text">方法</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#最简单的深拷贝"><span class="post-toc-number">5.</span> <span class="post-toc-text">最简单的深拷贝</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#简易深拷贝"><span class="post-toc-number">6.</span> <span class="post-toc-text">简易深拷贝</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-4"><a class="post-toc-link" href="#weakMap"><span class="post-toc-number">6.1.</span> <span class="post-toc-text">weakMap</span></a></li></ol></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#参考"><span class="post-toc-number">7.</span> <span class="post-toc-text">参考</span></a></li></ol>
        </nav>
    </aside>


<article id="post-js-浅拷贝与深拷贝/js-浅拷贝与深拷贝" class="post-article article-type-post fade" itemprop="blogPost">

    <div class="post-card">
        <h1 class="post-card-title">浅拷贝与深拷贝</h1>
        <div class="post-meta">
            <time class="post-time" title="2019-01-22 19:20:50" datetime="2019-01-22T11:20:50.000Z" itemprop="datePublished">2019-01-22</time>

            
	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/js/">js</a></li></ul>



            
<span id="busuanzi_container_page_pv" title="文章总阅读量" style="display:none">
    <i class="icon icon-eye icon-pr"></i><span id="busuanzi_value_page_pv"></span>
</span>


        </div>
        <div class="post-content" id="post-content" itemprop="postContent">
            <h3 id="概念"><a href="#概念" class="headerlink" title="概念"></a>概念</h3><h4 id="浅拷贝"><a href="#浅拷贝" class="headerlink" title="浅拷贝"></a>浅拷贝</h4><p>就是对复杂数据类型进行拷贝操作的时候，只是进行了简单的地址引用，并没有开辟新的栈空间来储存，此时在修改原来的对象时，会影响到新的对象。</p>
<p>光讲实在抽象了，直接往下看发生了什么<br><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> arr = [</span><br><span class="line">    &#123;<span class="attr">name</span>:<span class="string">'Andy'</span>&#125;,</span><br><span class="line">    &#123;<span class="attr">name</span>:<span class="string">'Bob'</span>&#125;,</span><br><span class="line">    &#123;<span class="attr">name</span>:<span class="string">'Cindy'</span>&#125;,</span><br><span class="line">  ];</span><br><span class="line"></span><br><span class="line">  <span class="keyword">var</span> obj = &#123;<span class="attr">name</span>:<span class="string">'ddd'</span>&#125;;</span><br><span class="line">  <span class="comment">// 再进行赋值也只是地址引用</span></span><br><span class="line">  arr.push(obj);</span><br><span class="line">  <span class="comment">// 改变o的值</span></span><br><span class="line">  obj.name = <span class="string">'eee'</span>;</span><br><span class="line">  <span class="comment">// 打印看arr，此时的push进去的值为 'eee'</span></span><br><span class="line">  <span class="built_in">console</span>.log(<span class="string">'浅拷贝'</span>,arr);</span><br></pre></td></tr></table></figure></p>
<h3 id="现象"><a href="#现象" class="headerlink" title="现象"></a>现象</h3><p>以上进行的操作一目了然，就是将<code>obj</code>这个对象<code>push</code>进<code>arr</code>之后，修改对象<code>obj</code>的值，会影响<code>arr</code>的值。</p>
<h3 id="原因"><a href="#原因" class="headerlink" title="原因"></a>原因</h3><p>复杂数据类型<code>（Object、Array）</code>的赋值等操作只是地址引用，对象<code>obj</code>与数组<code>arr</code>中对象指向的栈地址相同，导致修改<code>obj</code>的内容影响了<code>arr</code>的值。</p>
<h3 id="方法"><a href="#方法" class="headerlink" title="方法"></a>方法</h3><p>对于复杂数据类型进行<strong>深拷贝</strong>即可，注意直接使用另一个变量来获取<code>obj</code>的值依然是地址引用而已，即</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> p = obj;</span><br><span class="line">arr.push(p);</span><br></pre></td></tr></table></figure>
<p>结果依然会影响到<code>arr</code></p>
<p>此时使用循环遍历<code>obj</code>，将<code>obj</code>的键值内容依次赋值储存到另一个对象即可，但是如果对象里面又是对象呢，对于太过复杂的数据遍历起来真是头大。</p>
<h3 id="最简单的深拷贝"><a href="#最简单的深拷贝" class="headerlink" title="最简单的深拷贝"></a>最简单的深拷贝</h3><p>以下便是避免浅拷贝现象的简易方法，将<code>obj</code>进行字符串化后变成了简单数据类型，再将其转化成复杂数据类型<code>newObj</code>，则与<code>obj</code>没有瓜葛了，此时再怎么修改<code>obj</code>都不会影响到<code>arr</code>了</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> newObj = <span class="built_in">JSON</span>.parse(<span class="built_in">JSON</span>.stringify(obj));</span><br><span class="line">arr.push(newObj);</span><br></pre></td></tr></table></figure>
<p>但实际上这种方法局限性比较多，并不推荐使用，因为它并不支持<code>undefined</code>、<code>Function</code>、<code>RegExp</code>格式化。所以最保险还是自己实现一个深拷贝函数</p>
<h3 id="简易深拷贝"><a href="#简易深拷贝" class="headerlink" title="简易深拷贝"></a>简易深拷贝</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">clone</span>(<span class="params">target, map = new WeakMap(</span>)) </span>&#123;</span><br><span class="line">    <span class="keyword">if</span>(<span class="keyword">typeof</span> target === <span class="string">'object'</span>) &#123;</span><br><span class="line">    	<span class="keyword">let</span> cloneTarget = <span class="built_in">Array</span>.isArray(target) ? [] : &#123;&#125;</span><br><span class="line">        <span class="comment">// 防止循环引用</span></span><br><span class="line">        <span class="keyword">if</span>(map.get(target)) &#123;</span><br><span class="line">            <span class="keyword">return</span> map.get(target)</span><br><span class="line">        &#125;</span><br><span class="line">        map.set(target, cloneTarget)</span><br><span class="line">        <span class="keyword">for</span>(<span class="keyword">const</span> key <span class="keyword">in</span> target) &#123;</span><br><span class="line">            <span class="comment">// 递归拷贝</span></span><br><span class="line">            cloneTarget[key] = clone(target[key], map)</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="comment">// 返回拷贝完的值</span></span><br><span class="line">        <span class="keyword">return</span> cloneTarget</span><br><span class="line">    &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">        <span class="comment">// 简单数据类型直接返回</span></span><br><span class="line">        <span class="keyword">return</span> target</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h4 id="weakMap"><a href="#weakMap" class="headerlink" title="weakMap"></a>weakMap</h4><p><code>weakMap</code>对象虽然也是一组键/值对的集合，其中的键是<strong>弱引用</strong>的，弱引用是指不能确保其引用的对象不会被垃圾回收器回收的引用。一个对象若只被弱引用所引用，则被认为是<strong>不可访问</strong>（或<strong>弱可访问</strong>）的，并因此可能在任何时候被<strong>回收</strong></p>
<h3 id="参考"><a href="#参考" class="headerlink" title="参考"></a>参考</h3><p><a href="https://mp.weixin.qq.com/s/N2pfi2rANMpOX_H6AgyhMg" target="_blank" rel="noopener">聊聊面试必考-递归思想与实战</a></p>

        </div>

        <blockquote class="post-copyright">
    
    <div class="content">
        
<span class="post-time">
    最后更新时间：<time datetime="2019-11-17T03:05:00.586Z" itemprop="dateUpdated">2019-11-17 11:05:00</time>
</span><br>


        
        关于学习类文章网上已经有非常多，而此处文章都是我在学习过程中整理摘录的笔记，参考文章可以点击文末的参考链接进行查阅
        
    </div>
    
    <footer>
        <a href="https://lafen.gitee.io">
            <img src="/img/avatar.jpg" alt="lafen">
            lafen
        </a>
    </footer>
</blockquote>

        
<div class="page-reward">
    <a id="rewardBtn" href="javascript:;" class="page-reward-btn waves-effect waves-circle waves-light">赏</a>
</div>



        <div class="post-footer">
            
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/js/">js</a></li></ul>


            
<div class="page-share-wrap">
    

<div class="page-share" id="pageShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=https://lafen.gitee.io/2019/01/22/js-浅拷贝与深拷贝/js-浅拷贝与深拷贝/&title=《浅拷贝与深拷贝》 — lafen&pic=https://lafen.gitee.io/img/avatar.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=https://lafen.gitee.io/2019/01/22/js-浅拷贝与深拷贝/js-浅拷贝与深拷贝/&title=《浅拷贝与深拷贝》 — lafen&source=lafen's personal blog" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https://lafen.gitee.io/2019/01/22/js-浅拷贝与深拷贝/js-浅拷贝与深拷贝/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《浅拷贝与深拷贝》 — lafen&url=https://lafen.gitee.io/2019/01/22/js-浅拷贝与深拷贝/js-浅拷贝与深拷贝/&via=https://lafen.gitee.io" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=https://lafen.gitee.io/2019/01/22/js-浅拷贝与深拷贝/js-浅拷贝与深拷贝/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>



    <a href="javascript:;" id="shareFab" class="page-share-fab waves-effect waves-circle">
        <i class="icon icon-share-alt icon-lg"></i>
    </a>
</div>



        </div>
    </div>

    
<nav class="post-nav flex-row flex-justify-between">
  
    <div class="waves-block waves-effect prev">
      <a href="/2019/08/18/mpvue-自定义导航栏/mpvue-自定义导航栏/" id="post-prev" class="post-nav-link">
        <div class="tips"><i class="icon icon-angle-left icon-lg icon-pr"></i> Prev</div>
        <h4 class="title">mpvue-自定义导航栏</h4>
      </a>
    </div>
  

  
    <div class="waves-block waves-effect next">
      <a href="/2019/01/22/hexo-使用报错记录/hexo使用报错记录/" id="post-next" class="post-nav-link">
        <div class="tips">Next <i class="icon icon-angle-right icon-lg icon-pl"></i></div>
        <h4 class="title">hexo使用报错记录</h4>
      </a>
    </div>
  
</nav>



    




















</article>

<div id="reward" class="page-modal reward-lay">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <h3 class="reward-title">
        <i class="icon icon-quote-left"></i>
        打笔巨款？~
        <i class="icon icon-quote-right"></i>
    </h3>
    <div class="reward-content">
        
        <div class="reward-code">
            <img id="rewardCode" src="/img/wechat.jpg" alt="打赏二维码">
        </div>
        
        <label class="reward-toggle">
            <input id="rewardToggle" type="checkbox" class="reward-toggle-check" data-wechat="/img/wechat.jpg" data-alipay="/img/alipay.jpg">
            <div class="reward-toggle-ctrol">
                <span class="reward-toggle-item wechat">微信</span>
                <span class="reward-toggle-label"></span>
                <span class="reward-toggle-item alipay">支付宝</span>
            </div>
        </label>
        
    </div>
</div>



</div>

        <footer class="footer">
    <div class="top">
        
<p>
    <span id="busuanzi_container_site_uv" style="display:none">
        站点总访客数：<span id="busuanzi_value_site_uv"></span>
    </span>
    <span id="busuanzi_container_site_pv" style="display:none">
        站点总访问量：<span id="busuanzi_value_site_pv"></span>
    </span>
</p>


        <p>
            
                <span><a href="/atom.xml" target="_blank" class="rss" title="rss"><i class="icon icon-lg icon-rss"></i></a></span>
            
            <span>博客内容遵循 <a rel="license" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh">知识共享 署名 - 非商业性 - 相同方式共享 4.0 国际协议</a></span>
        </p>
    </div>
    <div class="bottom">
        <p><span>lafen &copy; 2019 - 2020</span>
            <span>
                
                Power by <a href="http://hexo.io/" target="_blank">Hexo</a> Theme <a href="https://github.com/yscoder/hexo-theme-indigo" target="_blank">indigo</a>
            </span>
        </p>
    </div>
</footer>

    </main>
    <div class="mask" id="mask"></div>
<a href="javascript:;" id="gotop" class="waves-effect waves-circle waves-light"><span class="icon icon-lg icon-chevron-up"></span></a>



<div class="global-share" id="globalShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=https://lafen.gitee.io/2019/01/22/js-浅拷贝与深拷贝/js-浅拷贝与深拷贝/&title=《浅拷贝与深拷贝》 — lafen&pic=https://lafen.gitee.io/img/avatar.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=https://lafen.gitee.io/2019/01/22/js-浅拷贝与深拷贝/js-浅拷贝与深拷贝/&title=《浅拷贝与深拷贝》 — lafen&source=lafen's personal blog" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https://lafen.gitee.io/2019/01/22/js-浅拷贝与深拷贝/js-浅拷贝与深拷贝/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《浅拷贝与深拷贝》 — lafen&url=https://lafen.gitee.io/2019/01/22/js-浅拷贝与深拷贝/js-浅拷贝与深拷贝/&via=https://lafen.gitee.io" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=https://lafen.gitee.io/2019/01/22/js-浅拷贝与深拷贝/js-浅拷贝与深拷贝/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>


<div class="page-modal wx-share" id="wxShare">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <p>扫一扫，分享到微信</p>
    <img src="" alt="微信分享二维码">
</div>




    <script src="//cdn.bootcss.com/node-waves/0.7.4/waves.min.js"></script>
<script>
var BLOG = { ROOT: '/', SHARE: true, REWARD: true };


</script>

<script src="//unpkg.com/hexo-theme-material-indigo@latest/js/main.min.js"></script>


<div class="search-panel" id="search-panel">
    <ul class="search-result" id="search-result"></ul>
</div>
<template id="search-tpl">
<li class="item">
    <a href="{path}" class="waves-block waves-effect">
        <div class="title ellipsis" title="{title}">{title}</div>
        <div class="flex-row flex-middle">
            <div class="tags ellipsis">
                {tags}
            </div>
            <time class="flex-col time">{date}</time>
        </div>
    </a>
</li>
</template>

<script src="//unpkg.com/hexo-theme-material-indigo@latest/js/search.min.js" async></script>






<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>



<script>
(function() {
    var OriginTitile = document.title, titleTime;
    document.addEventListener('visibilitychange', function() {
        if (document.hidden) {
            document.title = '死鬼去哪里了！';
            clearTimeout(titleTime);
        } else {
            document.title = '(つェ⊂)咦!又好了!';
            titleTime = setTimeout(function() {
                document.title = OriginTitile;
            },2000);
        }
    });
})();
</script>



<script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"debug":false,"model":{"scale":1,"jsonPath":"/live2dw/assets/shizuku.model.json"},"display":{"positon":"right","width":150,"height":300},"mobile":{"show":true,"scale":0.8},"react":{"opacity":0.8,"opacityDefault":0.8,"opacityOnHover":0.6},"log":false});</script></body>
</html>
